from 循环找图模块2 import run_action_until_image_disappears
import pyautogui
import win32gui
from ultralytics import YOLO
import time
import 检测框模块
from yolo2.find_and_perform_action_module import find_and_perform_action
from yolo2.yolo找图模块 import click_target_image
from moveFb模块 import movefb
from find_class_module import find_class_and_perform_action

# 假设已经有 hwnd 和 model
hwnd = 检测框模块.find_window()
model = YOLO(r"G:\yolov8\yolo\v11\runs\detect\train45\weights\best.pt").to('cuda')


def action_C():  # 动作一：循环执行的动作
    click_target_image(r"G:\zdh\yolo2\png\hsxhx.png", offset_x=0, offset_y=0, click_type='left')
    print("执行 C 动作")

def action_D():  # 动作二：某图消失后执行的动作
    print("执行 D 动作")
    return True

run_action_until_image_disappears(hwnd, model, r'G:\zdh\yolo2\png\hsxhx.png', action_C, action_D,confidence=0.99)